function getIcon(type) {
  if(type=='png' || type=='jpg' || type=='jpeg'){
    return 'fa-file-image'
  }else if(type=='docx'){
    return 'fa-file-word'
  }else if(type=='pdf'){
    return 'fa-file-pdf'
  }else if(type=='pptx'){
    return 'fa-file-powerpoint'
  }else if(type=='zip'||type=='rar'){
    return 'fa-file-archive'
  }else if(type=='xlsx'){
    return 'fa-file-excel'
  }else{
    return 'fa-file-alt'
  }
}
function getIconColor(type) {
  if(type=='png' || type=='jpg' || type=='jpeg'){
    return '#fcd05e'
  }else if(type=='docx'){
    return '#4991f3'
  }else if(type=='pdf'){
    return '#FF4343'
  }else if(type=='pptx'){
    return '#f46e43'
  }else if(type=='zip'||type=='rar'){
    return '#8c97b3'
  }else if(type=='xlsx'){
    return '#4991f3'
  }else{
    return '#fcd05e'
  }
}

function setPageTitle(title) {
  document.title = title+"-"+"写益文荟"
}
function getQueryVariable(variable)
{
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if(pair[0] == variable){return pair[1];}
  }
  return(false);
}

//密码正则
function regPassword() {
  return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,12}$/
}
//手机号正则
function regMobile() {
  return /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/
}
export default {
  regPassword,
  regMobile,
  getIcon,
  getIconColor,
  setPageTitle,
  getQueryVariable
};
